<?php

class Levels extends Admin_Controller
{
	
	public function __construct()
	{
		parent::__construct();
	}
	
	public function index()
	{
		$data['levels'] = new level;
		$data['levels']->get_page(10);
		$this->template->build('admin/levels/index',$data);
	}
	
	public function form($id = NULL)
	{	
		$data['level'] = new level($id);
		$this->template->build('admin/levels/form',$data);
	}
	
	public function save($id = NULL)
	{
		if($_POST)
		{
			$level = new level($id);
			$level->from_array($_POST);
			$level->save();
			set_notify('success', lang('save_data_complete'));	
		}
		redirect('users/admin/levels');
	}
	
	public function delete($id)
	{
		if($id)
		{
			$level = new level($id);
			$level->delete();	
			set_notify('success', lang('delete_data_complete'));	
		}
		redirect('users/admin/levels');
	}
	
}

?>